// Copyright 2018 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';
import 'changeInfo.dart';
import 'signOut.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:dio/dio.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return OKToast(
      child: MaterialApp(
        title: 'CumtLogin',
        home: Scaffold(
          appBar: AppBar(
            title: Text('CumtLogin'),
          ),
          body: new Column(
            children: <Widget>[
              new ToChangeInfo(),
              new Login(),
              new ToLogOut(),
            ],
          ),
        ),
      ),
    );
  }
}

class ToChangeInfo extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      height: 120.0,
      width: double.infinity,
      margin: const EdgeInsets.all(20.0),
      decoration: BoxDecoration(
        color: Colors.lightBlue,
      ),
      child: RaisedButton(
        child: Text(
          '填写/修改信息',
          style: TextStyle(
            fontSize: 24.0,
          ),
        ),
        onPressed: () {
          Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => ChangeInfo()),
          );
        },
      ),
    );
  }
}

class ToDial extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      height: 120.0,
      width: double.infinity,
      margin: const EdgeInsets.all(20.0),
      decoration: BoxDecoration(
        color: Colors.amber
      ),
      child: RaisedButton(
        child: Text(
          '拨打网络中心电话',
          style: TextStyle(
            fontSize: 24.0,
          ),
        ),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
    );
  }
}

class Login extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      height: 120.0,
      width: double.infinity,
      margin: const EdgeInsets.all(20.0),
      child: RaisedButton(
        onPressed: () {
          loginMethod();
        },
        child: Text(
          '一键登录',
          style: TextStyle(
            fontSize: 24.0
          ),
        ),
      ),
    );
  }
}

class ToLogOut extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      height: 120.0,
      width: double.infinity,
      margin: const EdgeInsets.all(20.0),
      decoration: BoxDecoration(
        color: Colors.greenAccent
      ),
      child: RaisedButton(
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => SignOut()),
          );
        },
        child: Text(
          '注销',
          style: TextStyle(
            fontSize: 24.0
,          ),
        ),
      )
    );
  }
}